# cadaver Makefile: generated from Makefile.in

PACKAGE = @PACKAGE_NAME@
VERSION = @PACKAGE_VERSION@

SHELL = @SHELL@
@SET_MAKE@

# Installation paths.
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
mandir = @mandir@
man1dir = $(mandir)/man1
datarootdir = @datarootdir@
datadir = $(prefix)/share
docdir = $(prefix)/doc/cadaver

# intl stuff
localedir = $(datadir)/locale
gnulocaledir = $(prefix)/share/locale
gettextsrcdir = $(prefix)/share/gettext
aliaspath = $(localedir):.

# Build paths
top_srcdir = @top_srcdir@
top_builddir = .
VPATH = @srcdir@

# Toolchain settings.
CC = @CC@
INCLUDES = -I$(top_srcdir)/src
CPPFLAGS = @DEFS@ @CPPFLAGS@ -DLOCALEDIR=\"$(localedir)\"
CFLAGS = @CFLAGS@
ALL_CFLAGS = $(CPPFLAGS) $(INCLUDES) $(CFLAGS)
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@ @NEON_LIBS@

TARGET = $(PACKAGE)
SUBDIRS = neon/src
OBJECTS = src/cadaver.o src/common.o src/commands.o src/ls.o	\
	 src/cmdline.o src/options.o src/utils.o src/edit.o \
	src/version.o src/search.o 
LIBOBJS = lib/basename.o lib/dirname.o lib/rpmatch.o lib/yesno.o	\
	lib/glob.o lib/getpass.o lib/tempname.o lib/mkstemp.o \
	@LIBOBJS@
ALLOBJS = $(OBJECTS) $(LIBOBJS)

# Installation programs
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
INSTALL = @INSTALL@

all: $(TARGET)

.PHONY: subdirs install clean distclean

$(TARGET): $(ALLOBJS) subdirs
	$(CC) $(CFLAGS) $(LDFLAGS) -o $(TARGET) $(ALLOBJS) $(LIBS)

.c.o:
	$(CC) $(ALL_CFLAGS) -o $@ -c $<

subdirs:
	for d in $(SUBDIRS); do (cd $$d; $(MAKE)); done

clean:
	rm -f $(OBJECTS) $(LIBOBJS) $(TARGET) *~
	for d in $(SUBDIRS); do (cd $$d; $(MAKE) clean); done

distclean: clean
	rm -f Makefile config.*
	for d in $(SUBDIRS); do (cd $$d; $(MAKE) distclean); done

install: $(TARGET) install-nls
	@echo "Creating directories..."
	$(INSTALL) -d $(DESTDIR)$(bindir)
	$(INSTALL) -d $(DESTDIR)$(man1dir)
	@echo "Installing $(TARGET) executable..."
	$(INSTALL_PROGRAM) $(TARGET) $(DESTDIR)$(bindir)/$(TARGET)
	@echo "Installing man page..."
	$(INSTALL_DATA) $(top_srcdir)/doc/cadaver.1 $(DESTDIR)$(man1dir)/cadaver.1

install-nls:
	@cd po && $(MAKE) install

update-copyright: Makefile
	@mv README.md README.orig
	@(sed -n '/^Copyright/q;p' < README.orig; \
	 grep -h Copyright src/*.[ch] po/*.po | \
	 sed -r 's/\(C\) [12].+[0-9],? /(C) /;s/^\#*//;s/^dnl//;s/<.*>//g;s/ @ .*//;s/[ ]*//;s/ *$$//;/Orton/d' | \
	 sort -u; echo '~~~') > README.md
	@diff -u README.orig README.md
	@rm -f README.orig

Makefile: Makefile.in
	@./config.status Makefile

# Deps
src/cadaver.o: src/cadaver.c config.h src/common.h	\
	src/options.h src/cmdline.h src/commands.h src/cadaver.h
src/options.o: src/options.c config.h src/options.h src/cadaver.h src/common.h 
src/cmdline.o: src/cmdline.c src/cmdline.h src/cadaver.h lib/basename.h \
	lib/glob.h src/commands.h src/common.h
src/commands.o: src/commands.c src/commands.h src/cadaver.h \
	lib/basename.h src/options.h src/common.h
src/edit.o: src/edit.c src/cadaver.h src/options.h src/common.h
src/common.o: src/common.c src/common.h config.h
src/ls.o: src/ls.c src/commands.h src/cadaver.h config.h
src/search.o: src/search.c src/commands.h src/cadaver.h config.h
src/utils.o: src/utils.c src/utils.h src/cadaver.h config.h
src/version.o: src/version.c src/utils.h src/cadaver.h config.h
lib/netrc.o: lib/netrc.c lib/netrc.h config.h
lib/getpass.o: lib/getpass.c lib/getpass.h config.h
lib/tempname.o: lib/tempname.c config.h
lib/mkstemp.o: lib/mkstemp.c src/common.h config.h
lib/yesno.o: lib/yesno.c src/common.h config.h
